{% extends 'base.html' %}
{% load static %}

{% block nav_index %}
  class = 'active'
{% endblock %}

{% block recent_nf %}

  {% if user %}
    <div class="row">
      <div class="pull-right" style="padding-top: 43px;">
        <a href="{% url 'notify' %}" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-plus"></span> New notification</a>
      </div>
    </div>
  {% endif %}
  <h2>Recent Notification</h2>
  {% for notification in recent_list %}
    <div class="row">
      <div>
        <h2 class="page-header">
          <a href="{% url 'detail' notification.pk %}">
            {{ notification.title }}
          </a>
        </h2>

        <div class="row" style="padding-top: 5px;padding-bottom: 10px">
          <div class="col-md-9">
            <div class="text-left">
              <div class="btn-group">
                <a href="{% url 'grade' notification.grade %}" class="btn btn-sm btn-default">{{ notification.grade }}</a>
                <a class="btn btn-sm btn-default">{{ notification.user }}</a>
              </div>
            </div>
          </div>

          <div class="col-md-3">
            <div class="text-right">
              <p class="text-muted"> {{ notification.created_time|date:"Y-m-j H:i:s" }} </p>
            </div>
          </div>
        </div>

        {{ notification.content|safe|linebreaks|truncatewords_html:150 }}
      </div><br><br>
    </div>
  {% endfor %}
  {% if not recent_list %}
    <h3 class="text-muted">No recent notifications</h3>
  {% endif %}

{% endblock %}